package com.patrol.config;

import org.springframework.stereotype.Component;
import org.springframework.util.DigestUtils;

/**
 * @author 房梦豪
 * @version 1.0
 * @description: TODO
 * @date 2021/9/5 9:15
 */
@Component
public class MyPasswordEncoder {

    public String md5(String rawPassword) {
        return DigestUtils.md5DigestAsHex(rawPassword.getBytes());
    }

    public boolean match(String rawPassword, String sqlPassword) {
        return DigestUtils.md5DigestAsHex(
                rawPassword.getBytes()).equals(sqlPassword);
    }
}
